/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: Dec 31, 2009
 * Time: 10:54:56 AM
 * To change this template use File | Settings | File Templates.
 */
import dk.brics.automaton.Automaton;
import java.util.*;
import org.jdom.Element;

// Referenced classes of package dk.brics.dsd:
//            Regexp, Context, Boolexp, Schema

class BoolexpRegexp extends Regexp
{

    BoolexpRegexp(Element element, Schema schema)
    {
        exp = Boolexp.parse(element, schema);
        cp = schema.allocCodePoint(exp);
    }

    public Element toXML(Context context)
    {
        return exp.toXML(context);
    }

    Automaton toAutomaton(Context context)
    {
        return Automaton.makeChar(cp);
    }

    void addBoolexps(Context context, Set set)
    {
        set.add(this);
    }

    void getMentioned(Context context, Set set, List list)
    {
        Iterator iterator = list.iterator();
        do
        {
            if(!iterator.hasNext())
                break;
            Element element = (Element)iterator.next();
            if(exp.isMentioned(new Context(context.sg, context.n, element, context.this_n, context.this_e, context.v)))
                set.add(element);
        } while(true);
    }

    boolean checkSimple(Context context)
    {
        return true;
    }

    Boolexp exp;
    char cp;
}
